package com.example.userproducer.controller;

import com.example.userproducer.model.User;
import com.example.userproducer.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


import java.util.List;

/**
 * @author 杰哥
 * @Title: UserController
 * @ProjectName user-producer
 * @Description: TODO
 * @date 2019/9/1116:00
 */
@Controller
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("findByAll")
    public List<User> findByAll() {

        List<User> byAll = userService.findByAll();
        for (User user : byAll) {
            System.out.println(user.getId() + "\t" + user.getUsername() + "\t" + user.getPassword());
        }
        return byAll;
    }
}
